﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BusinessLogic;

namespace AccountingGui.Views
{
    public partial class CustomerListForm : Form
    {
        private WGRUSEntities context;

        public CustomerListForm()
        {
            InitializeComponent();
        }

        private void CustomerListForm_Load(object sender, EventArgs e)
        {
            context = new WGRUSEntities();
            customerBindingSource.DataSource = context.Customers.ToList();
        }

        private void customerBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            Customer cust = customerBindingSource.Current as Customer;
            orderBindingSource.DataSource = cust.Orders;
        }
    }
}
